Multi-target automatic exposure and gain control based on pixel intensity distribution

ABSTRACT

An example method of multi-target automatic exposure and gain control based on pixel intensity distribution includes capturing a series of digital images with an image sensor. As the series of digital images are captured, exposure time and/or gain are adjusted to adjust a mean intensity value of the digital images until a target mean intensity value is reached. The method includes dynamically selecting the target mean intensity value from a plurality of target mean intensity values based on a relative number of pixels, in each captured digital image, that have an intensity value that falls outside a range of intensity values.

TECHNICAL FIELD

This disclosure relates generally to image sensors, and in particularbut not exclusively, relates to automatic exposure and gain control forimage sensors.

BACKGROUND INFORMATION

Image sensors have become ubiquitous. They are widely used in digitalstill cameras, cellular phones, security cameras, as well as, medical,automobile, and other applications. The technology used to manufactureimage sensors, and in particular, complementarymetal-oxide-semiconductor (CMOS) image sensors, has continued to advanceat great pace. For example, as digital imaging becomes more prevalent,technology strives to achieve images and video having better resolutionand color accuracy.

Conventional CMOS image sensors typically include an array of pixels,where each pixel includes a photodiode that transforms incident lightinto an electrical charge. Each individual pixel has an output that, fora fixed exposure time, eventually saturates with increasing lightintensity. Saturation of the photodiodes can produce unwanted imagesmearing due to an effect known as blooming, where excess charge spreadsinto neighboring pixels. Thus, one aim of the image sensor is to achieveimages in which objects are exposed properly, i.e., not too bright ortoo dark. Conventional image sensors often provide images whoseexposures are not optimized. Some conventional image sensors may applypost image-acquisition algorithms to allow the digital image data to befurther processed to achieve a particular color and intensity associatedwith a specific pixel. However, the more post image-acquisitioncorrections that are applied to an image, the more the overall qualityof an image may degrade. A similar phenomenon is known to filmphotographers, who recognize that a better print may be made from a goodnegative than a print that is made after applying multiple, albeitadvanced, manipulations to a mediocre negative.

In some conventional methods of automatic exposure control, a meanintensity of a single window of the whole or part of image isdetermined. The intensity may be luminance Y signal or one or more colorchannel signals. A predefined target mean intensity (i.e., a desiredfixed mean intensity) is then assigned and the difference between themean intensity and the target mean intensity is determined. Exposurecorrection is determined based upon this difference. However, using asingle predefined target mean intensity may still result in too manybright and/or too many dark pixels present in the image, which can makethe image uncomfortable to view. Furthermore, the application of asingle window of part of image when calculating the mean intensity oftenresults in less accurate target intensity estimation, since differentparts of the image may have different intensity distributions.

BRIEF DESCRIPTION OF THE DRAWINGS

Non-limiting and non-exhaustive embodiments of the invention aredescribed with reference to the following figures, wherein likereference numerals refer to like parts throughout the various viewsunless otherwise specified.

FIG. 1 is a block diagram illustrating an image sensor, in accordancewith an embodiment of the present disclosure.

FIG. 2 a flowchart illustrating a process of multi-target automaticexposure and gain control, in accordance with an embodiment of thepresent disclosure.

FIG. 3 is a histogram illustrating a pixel intensity distribution of adigital image.

FIG. 4 is a flowchart illustrating a process of calculating a meanintensity value of pixels included in a digital image, in accordancewith an embodiment of the present disclosure.

FIG. 5 is a diagram illustrating an image segmented into severalregions, with each region having an associated region weight factor, inaccordance with an embodiment of the present disclosure.

FIG. 6 is a chart illustrating the selection of a target mean intensityvalue, in accordance with an embodiment of the present disclosure.

FIG. 7 is a flowchart illustrating the selection of a target meanintensity value, in accordance with an embodiment of the presentdisclosure.

DETAILED DESCRIPTION

Embodiments of Multi-Target Automatic Exposure and Gain Control Based onPixel Intensity Distribution are described herein. In the followingdescription numerous specific details are set forth to provide athorough understanding of the embodiments. One skilled in the relevantart will recognize, however, that the techniques described herein can bepracticed without one or more of the specific details, or with othermethods, components, materials, etc. In other instances, well-knownstructures, materials, or operations are not shown or described indetail to avoid obscuring certain aspects.

Reference throughout this specification to “one embodiment” or “anembodiment” means that a particular feature, structure, orcharacteristic described in connection with the embodiment is includedin at least one embodiment of the present invention. Thus, theappearances of the phrases “in one embodiment” or “in an embodiment” invarious places throughout this specification are not necessarily allreferring to the same embodiment. Furthermore, the particular features,structures, or characteristics may be combined in any suitable manner inone or more embodiments.

FIG. 1 is a block diagram illustrating an image sensor 100, inaccordance with an embodiment of the present disclosure. The illustratedembodiment of image sensor 100 includes an active area (i.e., pixelarray 105), readout circuitry 110, function logic 115, and controlcircuitry 120.

Pixel array 105 may be a two-dimensional array of backside or frontsideilluminated imaging pixels (e.g., pixels PD1, . . . , Pn). In oneembodiment, each pixel is an active pixel sensor (“APS”), such as acomplementary metal-oxide-semiconductor (“CMOS”) imaging pixel. Asillustrated, each pixel is arranged into a row (e.g., rows R1 to Ry) anda column (e.g., column C1 to Cx) to acquire image data of a person,place, or object, which can then be used to render an image of theperson, place, or object.

After each pixel has acquired its image data or image charge, the imagedata 104 is read out by readout circuitry 110 and transferred tofunction logic 115. Readout circuitry 110 may include amplificationcircuitry, analog-to-digital conversion circuitry, or otherwise.Function logic 115 may simply store the image data 104 or evenmanipulate the image data by applying post image effects (e.g., crop,rotate, remove red eye, adjust brightness, adjust contrast, orotherwise). In one embodiment, readout circuitry 110 may read out a rowof image data at a time along readout bit lines (illustrated) or mayreadout the image data using a variety of other techniques (notillustrated), such as a serial readout or a full parallel readout of allpixels simultaneously.

Control circuitry 120 is coupled to pixel array 105 to controloperational characteristics of pixel array 105. For example, controlcircuitry 120 may include a parameter adjustor 121 for adjusting theexposure and/or gain of pixel array 105 in response to the acquiredimage data 104. As will be discussed in more detail below, parameteradjustor 121 may adjust the exposure and/or gain of pixel array 105 byway of control signal(s) 102 as a series of digital images are acquiredby pixel array 105 in order to adjust a mean intensity value of eachdigital image until a target mean intensity value is reached. Parameteradjustor 121 may also dynamically select the target mean intensity valuefrom several possible target mean intensity values based on the relativenumber of pixels, in each captured digital image, that have an intensityvalue that falls outside a range of intensity values. In one embodiment,the range of intensity values includes pixels whose intensity values aredetermined to be neither too bright, nor too dark. Thus, instead ofusing a single fixed target mean intensity value, as is done in someconventional applications, embodiments of the present invention usemultiple target mean intensity values to avoid the accumulation of toomany bright and/or too many dark pixels in the image. Accordingly, insome embodiments, after the automatic exposure/gain control iscompleted, a subsequent image(s) will have predefined percentages ofsaturated and/or dark pixels.

Control circuitry 120 includes parameter adjustor 121 for performing anyof the processes described herein. Although FIG. 1 illustrated parameteradjustor 121 as included in control circuitry 120, other embodiments mayinclude parameter adjustor disposed elsewhere within image sensor 100,or even separate and off-chip from image sensor 100. Parameter adjustor121 can, but need not necessarily include, one or more microprocessors,embedded processors, controllers, application specific integratedcircuits (ASICs), digital signal processors (DSPs), and the like. Theterm processor describes the functions implemented by the system ratherthan specific hardware. Moreover, as used herein the term “memory”refers to any type of computer storage medium, including long term,short term, or other memory associated with image sensor 100, and is notto be limited to any particular type of memory or number of memories, ortype of media upon which memory is stored.

FIG. 2 a flowchart illustrating a process 200 of multi-target automaticexposure and gain control, in accordance with an embodiment of thepresent disclosure. Process 200 begins at block 202 and immediatelyproceeds to process block 204 where a first digital image is captured(e.g., acquired by pixel array 105 of FIG. 1). Next, in process block206, a relative number of pixels in the captured image that have anintensity value that falls outside a range of intensity values isdetermined. As shown in FIG. 2, this may include determining apercentage of saturated pixels (i.e., % SAT) and/or a percentage of darkpixels (i.e., % DRK) included in the captured image.

By way of example, FIG. 3 is a histogram 300 illustrating a pixelintensity distribution of an example captured digital image. As shown inFIG. 3, pixels that have an intensity value in the range between lowerthreshold 302 and upper threshold 304 may be considered as pixels havinga “normal” or “acceptable” intensity value. Pixels that have anintensity value that falls outside of this range may be deemed as eithertoo dark or as too bright. That is, pixels whose intensity value is lessthan lower threshold 302 may be deemed as dark pixels, whereas pixelsthat have an intensity value greater than upper threshold 304 may bedeemed as saturated pixels.

Accordingly, process block 206, in determining the percentage ofsaturated pixels, may simply calculate the percentage of pixels includedin the captured image that have an intensity value greater than upperthreshold 304. Similarly, determining the percentage of dark pixels mayinclude calculating the percentage of pixels included in the capturedimage that have an intensity value less than lower threshold 302.

In one embodiment, the intensity value of each pixel is the luminance Yvalue of the respective pixel. In another embodiment, the intensityvalue of each pixel is the largest of the red (R) value, the green (G)value, and the blue (B) value of the respective pixel. In yet anotherembodiment, the intensity value may be any of the color valuesimplemented by the pixel array (e.g., red (R), blue (B), cyan (C),magenta (M), or yellow (Y)).

Referring now back to FIG. 2, process 200 then proceeds to process block208, which may, in some iterations of process 200, select a target meanintensity value based on the results of process block 206. In oneembodiment, the target mean intensity value is selected from severalpossible target mean intensity values. For example, embodiments of thepresent disclosure may include a low target mean intensity value forimages having a relatively large number of saturated pixels, a hightarget mean intensity value for images having a relatively large numberof dark pixels, and a mid-target mean intensity value for images havingneither too many saturated pixels nor too many dark pixels. In addition,embodiments disclosed herein may provide for additional target meanintensity values that are between the low and mid-target mean values andalso between the mid and high target mean values. Details of selecting atarget mean intensity value will be described in more detail below withreference to FIGS. 6 and 7.

Next, in process block 210, a mean intensity value of the captured imageis calculated. In one embodiment, calculating the mean simply includescalculating the average the intensity values of the pixels included inthe image. However, embodiments of the present disclosure may providefor a more accurate calculation of the mean intensity value by applyingone or more weighting factors to each pixel's intensity value. FIG. 4 isa flowchart illustrating an example process 400 of calculating the meanintensity value of pixels included in a digital image in accordance withan embodiment of the present disclosure. Process 400 is one possibleimplementation of process block 210 of FIG. 2.

In process block 402, the digital image is segmented into severaldistinct regions. For example, FIG. 5 is a diagram illustrating an imagethat has been segmented into several regions (e.g., regions 0-12).Although FIG. 5 illustrates an image segmented into thirteen (13)regions, embodiments of the present disclosure may include segmentingthe image into any number of regions including two or more. As shown inFIG. 5, each region has an associated region weight factor (e.g.,W0-W12). In one embodiment, the region weight factor for regions locatednear the center of the image (e.g., region weight factor W8) may begreater than the region weight factors for regions located near theperiphery of the image (e.g., W0).

Next, in process block 404 of process 400, the intensity value (Yi) ofeach pixel is weighted a first time with the region weight factor (Wi)that is associated with the region where a respective pixel is located.For example, the intensity values for pixels located at or near thecenter of the image will be weighted with region weight factor W8, whileintensity values for pixels located at or near the upper-left cornerwill be weighted with region weight factor W0.

In process block 406, the intensity values of each pixel are nowweighted a second time, this time with an intensity weight factor (Mi)that is selected based on the original (i.e., unweighted) intensityvalue (Yi) of the respective pixel. For example, the intensity value ofeach pixel may be placed into one of three intensity brackets, wheredifferent intensity weight factors are assigned to different intensitybrackets. In one embodiment, the intensity weight factor (Mi) for theintensity value (Yi) of a pixel i of the image, is determined asfollows:

$\begin{matrix}{{Mi} = \begin{Bmatrix}{{M\; 0},{{{if}\mspace{14mu}{Yi}} < {LOW\_ THRESH}},} \\{{M\; 1},{{{if}\mspace{14mu}{LOW\_ THRESH}} \leq {Yi} \leq {UPPER\_ THRESH}},} \\{{M\; 2},{{{if}\mspace{14mu}{Yi}} > {UPPER\_ THRESH}}}\end{Bmatrix}} & {{EQ}.\mspace{14mu} 1}\end{matrix}$

In one embodiment, the intensity weight factors M0 (intensity weightfactor for dark pixels) and M2 (intensity weight factor for saturatedpixels) are larger than the intensity weight factor M1 (intensity weightfactor for normal brightness pixels). In other words, the intensityweight factor is greater for pixels whose intensity value falls outsidethe range of “normal” or “acceptable” intensity values as defined by thelower threshold 302 and upper threshold 304 of FIG. 3, than theintensity weight factor for pixels whose intensity value falls withinthe range.

Next, process 400 proceeds to process block 408, where the summation ofthe weighted intensity values is calculated. In one embodiment, process400 of calculating the mean intensity value may be represented by thefollowing equation:

$\begin{matrix}{{{Mean}\mspace{14mu}{Intensity}\mspace{14mu}{Value}} = \frac{\sum\;\left( {{Wi}*{Mi}*{Yi}} \right)}{\sum\;\left( {{Wi}*{Mi}} \right)}} & {{EQ}.\mspace{14mu} 2}\end{matrix}$

Referring now back to FIG. 2, after the mean intensity value iscalculated in process block 210, process 200 proceeds to decision block212 where the calculated mean intensity value is compared against thetarget mean intensity value. If the calculated mean intensity value isnot equal to the target mean intensity value then process 200 advancesto process block 214. In process block 214 a parameter of the imagesensor is adjusted to adjust the mean intensity value of the nextacquired image. In one example, the parameter to be adjusted is theexposure time of the image sensor (e.g., amount of time photoelectronsare allowed to accumulate in photodiode). In another embodiment, theparameter to be adjusted is the gain applied to each pixel of the imagesensor. In yet another embodiment, both the exposure time and gain arethe adjusted parameters. In this embodiment, the gain may only beincreased once the exposure time has reached a maximum value. Similarly,in one example, the exposure time may be only decreased once the gainhas been first reduced to unity (i.e., 1.0).

With the parameter of the image sensor adjusted in process block 214,process 200 then returns to process block 204 to capture another digitalimage. If, in decision block 212, the calculated mean intensity valueequals the target mean intensity value, then the auto exposure/gaincontrol of process 200 is complete at block 216. Accordingly, theautomatic exposure/gain control of process 200 includes capturing aseries of digital images and adjusting the exposure and/or gain as theimages are captured until a target mean intensity value is reached. Asthe digital images are captured a target mean intensity value isdynamically selected based on the percentage of saturated and/or darkpixels included in each captured image.

For example, the target mean intensity value may be set to a low targetmean intensity value while the percentage of saturated pixels is greaterthan a first threshold percentage amount. Similarly, the target meanintensity value may be set to a high target mean intensity value whilethe percentage of dark pixels is greater than a second thresholdpercentage amount. If both the percentage of saturated pixels is lessthan the first percentage amount and the percentage of dark pixels isless than the second threshold percentage amount, then the target meanintensity value may be set to a mid-target mean intensity value, where:LOW TARGET<MID-TARGET<HIGH TARGET  EQ.3

FIG. 6 is a chart 600 illustrating the selection of a target meanintensity value, in accordance with an embodiment of the presentdisclosure. Chart 600 illustrates several actions (e.g., actions(A)-(G)) that may be undertaken by an image sensor (e.g., image sensor100) to select a target mean intensity value while the digital imagesare captured for the purpose of automatic exposure/gain control. Action(A) illustrates the decreasing of a parameter (e.g., exposure and/orgain) while the percentage of saturated pixels in each captured imageexceeds a first threshold percentage amount (TH1) in order to reduce thecalculated mean intensity value as the images are acquired. If, whilereducing the parameter of the image sensor, the calculated meanintensity value is reduced to be equal to or less than the low targetmean intensity value, then the target mean intensity value is set to thelow target mean intensity value in block 602 and the automaticgain/exposure control is complete. If, however, while reducing theparameter in action (A), the percentage of saturated pixels drops belowthe first threshold percentage amount (e.g., see decision 604), then theimage sensor proceeds to action (B) where the parameter is then adjustedsuch that the mean intensity value is approximately equal to themid-target mean intensity value. If while at the mid-target meanintensity value, both the percentage of saturated pixels is less thanthe first threshold amount (TH1) and the percentage of dark pixels isless than the second threshold amount (TH2) then block 606 sets thetarget mean intensity value to the mid-target mean intensity value andthe automatic gain/exposure control is complete.

In action (C), if the percentage of saturated pixels is greater than thefirst threshold percentage amount (TH1) while the mean intensity valueis at the mid-target mean intensity value, the image sensor thenproceeds to action (e), where the parameter of the image sensor isdecreased until the percentage of saturated pixels is less than thefirst threshold percentage amount, such that the mean intensity value isbetween the low target mean intensity value and the mid-target meanintensity value. In block 610, the target mean intensity value is set toa value between the low and mid-target mean intensity values and theautomatic gain/exposure control is complete.

In action (D), if the percentage of saturated pixels is less than thefirst threshold percentage amount but the percentage of dark pixels isgreater than the second threshold percentage amount (TH2) while the meanintensity value is at the mid-target mean intensity value, the imagesensor then proceeds to action (F), where the parameter is increaseduntil the percentage of dark pixels drops below the second thresholdpercentage amount (TH2). If in decision block 616 it is determined thatthe percentage of dark pixels has indeed dropped below the secondthreshold percentage amount the target mean intensity value is set inblock 618, such that the mean intensity value is between the mid-targetmean intensity value and the high target mean intensity value and theautomatic gain/exposure control is complete.

If, while increasing the parameter in action (F), the mean intensityvalue increases to greater than or equal to the high target meanintensity value, the image sensor stops increasing the parameter, thetarget mean intensity value is set to the high target mean intensityvalue in block 614, and the automatic gain/exposure control completes.

FIG. 7 is a flowchart illustrating a process 700 of selecting a targetmean intensity value, in accordance with an embodiment of the presentdisclosure. Process 700 is similar to the actions illustrated in chart600 of FIG. 6, and illustrates a process that may be undertaken by animage sensor (e.g., image sensor 100) to select a target mean intensityvalue while the digital images are captured for the purpose of automaticexposure/gain control.

Process 700 begins in block 702 where the capturing and analysis ofdigital images begins. In decision block 704, the percentage ofsaturated pixels (% SAT) is compared with the first threshold percentageamount (TH1). If the percentage of saturated pixels exceeds the firstthreshold percentage amount the process 700 proceeds to process block706 where the exposure and/or gain of the image sensor are decreased. Indecision block 708, the calculated mean intensity value of the nextcaptured image is then compared against the low target mean intensityvalue. If the calculated mean intensity value is less than or equal tothe low target mean intensity value then process 700 ends in processblock 710, where the parameter of the image sensor is set such that themean intensity value is approximately equal to the low target meanintensity value. If, in decision block 708, the calculated meanintensity value had not yet reached the low target mean intensity value,then process 700 returns to decision block 704 to again compare thepercentage of saturated pixels with the first threshold percentageamount (TH1). If, due to the decreasing of the parameter in block 706,the percentage of saturated pixels drops below the first thresholdpercentage amount, then process 700 proceeds to process block 712, wherethe exposure and/or gain are adjusted in order to set the mean intensityvalue to the mid-target mean intensity value. The adjustment of theexposure and/or gain in block 712 may include increasing the exposureand/or gain or it may include decreasing the exposure and/or gaindepending on whether the mean intensity value in decision block 704 wasgreater than or less than the mid-target mean intensity value.

Next, in decision block 714, with the mean intensity value set to themid-target mean intensity value, the percentage of saturated pixels isagain compared with the first threshold percentage amount. If thepercentage of saturated pixels is still less than the first thresholdpercentage amount then decision block 716 compares the percentage ofdark pixels (% DRK) with the second threshold percentage amount (TH2).If both the percentage of saturated pixels and dark pixels are less thantheir respective threshold percentage amounts, process 700 ends inprocess block 718, where the parameter of the image sensor is set suchthat the mean intensity value is approximately equal to the mid-targetmean intensity value.

If, in decision block 714, it is determined that setting the meanintensity value to the mid-target mean intensity value resulted in thepercentage of saturated pixels rising above the first thresholdpercentage amount, process block 720 and decision block 722 reduce theexposure and/or gain until the percentage of saturated pixels dropsbelow the first threshold percentage amount. When the percentage ofsaturated pixels drops below the threshold percentage amount in decisionblock 722, process 700 then ends in process block 724, where theparameter of the image sensor is set such that the mean intensity valueis between the low target mean intensity value and the mid-target meanintensity value.

Returning now back to decision block 716, if, while the mean intensityvalue is at the mid-target mean intensity value and the percentage ofdark pixels exceeds the second threshold percentage amount, process 700then proceeds to process block 726 to begin increasing the exposureand/or gain. Process block 726, decision block 728, and decision block730, include increasing the exposure and/or gain of the image sensoruntil either the percentage of dark pixels drops below the secondthreshold percentage amount (i.e., decision block 728) or until thecalculated mean intensity value is greater than or equal to the hightarget mean intensity value (i.e., decision block 730).

If, while increasing the exposure and/or gain by way of block 726, thepercentage of dark pixels drops below the second threshold percentageamount, process 700 ends in process block 734, where the parameter ofthe image sensor is set such that the mean intensity value is betweenthe mid-target mean intensity value and the high target mean intensityvalue. Similarly, if while increasing the exposure and/or gain, thecalculated mean intensity value reaches or exceeds the high target meanintensity value, then process 700 ends in process block 732, where theparameter of the image sensor is set such that the mean intensity valueis approximately equal to the high target mean intensity value.

The processes described herein may be implemented by various meansdepending upon the application. For example, these processes may beimplemented in hardware, firmware, software, or any combination thereof.For a hardware implementation, processing units may be implementedwithin one or more application specific integrated circuits (ASICs),digital signal processors (DSPs), digital signal processing devices(DSPDs), programmable logic devices (PLDs), field programmable gatearrays (FPGAs), processors, controllers, micro-controllers,microprocessors, electronic devices, other electronic units designed toperform the functions described herein, or a combination thereof.

For a firmware and/or software implementation, the processes may beimplemented with modules (e.g., procedures, functions, and so on) thatperform the functions described herein. Any computer-readable mediumtangibly embodying instructions may be used in implementing theprocesses described herein. For example, program code may be stored inimage sensor 100 (FIG. 1) and executed by a processor. Memory may beimplemented within or external to the image sensor.

If implemented in firmware and/or software, the functions may be storedas one or more instructions or code on a computer-readable medium.Examples include non-transitory computer-readable media encoded with adata structure and computer-readable media encoded with a computerprogram. Computer-readable media includes physical computer storagemedia. A storage medium may be any available medium that can be accessedby a computer. By way of example, and not limitation, suchcomputer-readable media can comprise RAM, ROM, Flash Memory, EEPROM,CD-ROM or other optical disk storage, magnetic disk storage or othermagnetic storage devices, or any other medium that can be used to storedesired program code in the form of instructions or data structures andthat can be accessed by a computer; disk and disc, as used herein,includes compact disc (CD), laser disc, optical disc, digital versatiledisc (DVD), floppy disk and blu-ray disc where disks usually reproducedata magnetically, while discs reproduce data optically with lasers.Combinations of the above should also be included within the scope ofcomputer-readable media.

The order in which some or all of the process blocks appear in eachprocess discussed above should not be deemed limiting. Rather, one ofordinary skill in the art having the benefit of the present disclosurewill understand that some of the process blocks may be executed in avariety of orders not illustrated.

Those of skill would further appreciate that the various illustrativelogical blocks, modules, engines, circuits, and algorithm stepsdescribed in connection with the embodiments disclosed herein may beimplemented as electronic hardware, computer software, or combinationsof both. To clearly illustrate this interchangeability of hardware andsoftware, various illustrative components, blocks, modules, engines,circuits, and steps have been described above generally in terms oftheir functionality. Whether such functionality is implemented ashardware or software depends upon the particular application and designconstraints imposed on the overall system. Skilled artisans mayimplement the described functionality in varying ways for eachparticular application, but such implementation decisions should not beinterpreted as causing a departure from the scope of the presentinvention.

What is claimed is:
 1. A method, comprising: capturing a series ofdigital images with an image sensor; as the series of digital images arecaptured, adjusting at least one parameter of the image sensor selectedfrom a group consisting of exposure time and gain to adjust a meanintensity value of the digital images until a target mean intensityvalue is reached; selecting the target mean intensity value from aplurality of target mean intensity values based on a number of pixels,in each captured digital image, that have an intensity value that fallsoutside a range of intensity values; calculating mean intensity value ofpixels included in each digital image as the digital images arecaptured; wherein calculating the mean intensity value of the pixelsincluded in a digital image comprises: segmenting the digital image intoa plurality of regions, wherein each of the plurality of regions has anassociated region weight factor; weighting an intensity value of eachpixel a first time with a region weight factor that is associated with aregion where a respective pixel is located; weighting an intensity valueof each pixel a second time with an intensity weight factor that isselected from a plurality of intensity weight factors based on anunweighted intensity value of a respective pixel; wherein the intensityweight factors are greater for pixels whose intensity values falloutside the range of intensity values than the intensity weight factorsfor pixels whose intensity values fall within the range of intensityvalues; and computing a summation of the weighted intensity values ofthe pixels.
 2. The method of claim 1, wherein the mean intensity valueis calculated as:Σ(Wi*Mi*Yi)/Σ(Wi*Mi) where Wi Is the region weight factor of arespective pixel, Mi is the intensity weight factor of a respectivepixel, and Yi is the intensity value of a respective pixel.
 3. Themethod of claim 1, wherein selecting the target mean intensity valuecomprises, for each digital image as they are captured: determining afirst percentage of pixels in a digital image that have an intensityvalue greater than an upper threshold of the range of intensity values;and setting the target mean intensity value to a first value selectedfrom the plurality of target mean intensity values if the firstpercentage is greater that a first threshold percentage amount.
 4. Themethod of claim 3, wherein selecting the target mean intensity valuefurther comprises, for each digital image as they are captured:determining a second percentage of the pixels in the digital image thathave an intensity value less than a lower threshold of the range ofintensity values; and setting the target mean intensity value to asecond value selected from the plurality of target mean intensity valuesif the second percentage is greater that a second threshold percentageamount.
 5. The method of claim 4, wherein selecting the target meanintensity value further comprises, for each digital image as they arecaptured, setting the target mean intensity value to a third valueselected from the plurality of target mean intensity values if the firstpercentage is less than the first threshold percentage amount and thesecond percentage is less than the second threshold percentage amount.6. The method of claim 5, wherein the first value selected from theplurality of target mean intensity values is less than the second valueand wherein the third value is between the first and second values. 7.The method of claim 1, wherein adjusting the at least one parameter ofthe image sensor comprises: (a) decreasing the at least one parameterwhile a first percentage of saturated pixels in each captured digitalimage exceeds a first threshold percentage amount until the meanintensity value is less than or equal to a low target mean intensityvalue; (b) if, while decreasing the at least one parameter in step (a),the first percentage of saturated pixels drops below the first thresholdpercentage amount, then adjusting the at least one parameter such thatthe mean intensity value is approximately equal to a mid-target meanintensity value; (c) if the first percentage of saturated pixels isgreater than the first threshold percentage amount while the meanintensity value is at the mid-target mean intensity value, decreasingthe at least one parameter until the first percentage of saturatedpixels is less than the first threshold percentage amount, such that themean intensity value is between the low target mean intensity value andthe mid-target mean intensity value; (d) if the first percentage ofsaturated pixels is less than the first threshold percentage amount anda second percentage of dark pixels is greater than a second thresholdpercentage amount while the mean intensity value is at the mid-targetmean intensity value, increasing the at least one parameter until thesecond percentage of dark pixels is less than the second thresholdpercentage amount, such that the mean intensity value is between themid-target mean intensity value and a high target mean intensity value;and (e) if, while increasing the at least one parameter in step (d), themean intensity value increases to greater than or equal to the hightarget mean intensity value, stopping the increasing of the at least oneparameter.
 8. The method of claim 1, wherein the intensity value of eachpixel is a luminance Y value of the respective pixel.
 9. The method ofclaim 1, wherein the intensity value of each pixel is the largest of ared (R) value, a green (G) value, and a blue (B) value of the respectivepixel.
 10. A non-transitory computer-readable medium including programcode stored thereon, the program code comprising instructions to:capture a series of digital images with an image sensor; as the seriesof digital images are captured, adjust at least one parameter of theimage sensor selected from a group consisting of exposure time and gainto adjust a mean intensity value of the digital images until a targetmean intensity value is reached; select the target mean intensity valuefrom a plurality of target mean intensity values based on a number ofpixels, in each captured digital image, that have an intensity valuethat falls outside a range of intensity values; calculating meanintensity value of pixels included in each digital image as the digitalimages are captured, wherein calculating the mean intensity valueincludes: segmenting each digital image into a plurality of regions,wherein each of the plurality of regions has an associated region weightfactor; weighting an intensity value of each pixel a first time with aregion weight factor that is associated with a region where a respectivepixel is located; weighting an intensity value of each pixel a secondtime with an intensity weight factor that is selected from a pluralityof intensity weight factors based on an unweighted intensity value of arespective pixel; wherein the intensity weight factors are greater forpixels whose intensity values fall outside the range of intensity valuesthan the intensity weight factors for pixels whose intensity values fallwithin the range of intensity values; and computing a summation of theweighted intensity values of the pixels.
 11. The non-transitorycomputer-readable medium of claim 10, wherein the instruction to selectthe target mean intensity value comprises instructions to, for eachdigital image as they are captured: determine a first percentage ofpixels in a digital image that have an intensity value greater than anupper threshold of the range of intensity values; and set the targetmean intensity value to a first value selected from the plurality oftarget mean intensity values if the first percentage is greater that afirst threshold percentage amount.
 12. The non-transitorycomputer-readable medium of claim 11, wherein the instructions to selectthe target mean intensity value further comprises instructions to, foreach digital image as they are captured: determine a second percentageof the pixels in the digital image that have an intensity value lessthan a lower threshold of the range of intensity values; and set thetarget mean intensity value to a second value selected from theplurality of target mean intensity values if the second percentage isgreater that a second threshold percentage amount.
 13. Thenon-transitory computer-readable medium of claim 12, wherein theinstructions to select the target mean intensity value further comprisesinstructions to, for each digital image as they are captured, set thetarget mean intensity value to a third value selected from the pluralityof target mean intensity values if the first percentage is less than thefirst threshold percentage amount and the second percentage is less thanthe second threshold percentage amount.
 14. The non-transitorycomputer-readable medium of claim 13, wherein the first value selectedfrom the plurality of target mean intensity values is less than thesecond value and wherein the third value is between the first and secondvalues.
 15. An image sensor, comprising: a plurality of pixels; areadout circuit coupled to the plurality of pixels for capturing aseries of digital images; and a parameter adjustor coupled to thereadout circuit for: as the series of digital images are captured,adjusting at least one parameter of the image sensor selected from agroup consisting of exposure time and gain to adjust a mean intensityvalue of the digital images until a target mean intensity value isreached; selecting the target mean intensity value from a plurality oftarget mean intensity values based on a number of pixels, in eachcaptured digital image, that have an intensity value that falls outsidea range of intensity values; wherein the parameter adjustor comprises amean intensity calculator for calculating a mean intensity value ofpixels included in each digital image as the digital images arecaptured, wherein calculating the mean intensity value includes:segmenting each digital image into a plurality of regions, wherein eachof the plurality of regions has an associated region weight factor;weighting an intensity value of each pixel a first time with a regionweight factor that is associated with a region where a respective pixelis located; weighting an intensity value of each pixel a second timewith an intensity weight factor that is selected from a plurality ofintensity weight factors based on an unweighted intensity value of arespective pixel; wherein the intensity weight factors are greater forpixels whose intensity values fall outside the range of intensity valuesthan the intensity weight factors for pixels whose intensity values fallwithin the range of intensity values; and computing a summation of theweighted intensity values of the pixels.
 16. The image sensor of claim15, wherein selecting the target mean intensity value from a pluralityof target mean intensity values includes: determining a first percentageof pixels in a digital image that have an intensity value greater thanan upper threshold of the range of intensity values; and setting thetarget mean intensity value to a first value selected from the pluralityof target mean intensity values if the first percentage is greater thata first threshold percentage amount.
 17. The image sensor of claim 16,wherein selecting the target mean intensity value from a plurality oftarget mean intensity values further includes: determining a secondpercentage of the pixels in the digital image that have an intensityvalue less than a lower threshold of the range of intensity values; andsetting the target mean intensity value to a second value selected fromthe plurality of target mean intensity values if the second percentageis greater that a second threshold percentage amount.
 18. The imagesensor of claim 17, wherein selecting the target mean intensity valuefrom a plurality of target mean intensity values further includessetting the target mean intensity value to a third value selected fromthe plurality of target mean intensity values if the first percentage isless than the first threshold percentage amount and the secondpercentage is less than the second threshold percentage amount.
 19. Theimage sensor of claim 18, wherein the first value selected from theplurality of target mean intensity values is less than the second valueand wherein the third value is between the first and second values.